// dofile of "A Replication of “An Experimental Test of the Expectancy-Disconfirmation Theory of Citizen Satisfaction”"

***************
* Figure 1  *
***************

**Adapted from Van Ryzin (2004). Coefficients are from Van Ryzin (2013)

***************
* Figure 2  *
***************

use replication_data.dta,clear
keep if shenzhen==0
tab experimentgroup

use replication_data.dta,clear
keep if shenzhen==1
tab experimentgroup

***************
* Figure 3a,b  *
***************
use replication_data.dta,clear
keep if shenzhen==0
ttest expectation ,by ( expectationgroup ) 
ttest clean ,by ( performancegroup )

use replication_data.dta,clear
keep if shenzhen==1
ttest expectation ,by ( expectationgroup ) 
ttest clean ,by ( performancegroup )

***************
* Figure 4  *
***************
use replication_data.dta,clear
keep if shenzhen==0
pathreg ( disconfirmation expectationgroup performancegroup ) ( satisfication disconfirmation expectationgroup performancegroup )

use replication_data.dta,clear
keep if shenzhen==1
pathreg ( disconfirmation expectationgroup performancegroup ) ( satisfication disconfirmation expectationgroup performancegroup )

***************
* Figure 5  *
***************
use replication_data.dta,clear
keep if shenzhen==0
egen meansatisfication1= mean( satisfication ) if experimentgroup ==1
egen meansatisfication2= mean( satisfication ) if experimentgroup ==2
egen meansatisfication3= mean( satisfication ) if experimentgroup ==3
egen meansatisfication4= mean( satisfication ) if experimentgroup ==4

use replication_data.dta,clear
keep if shenzhen==1
egen meansatisfication1= mean( satisfication ) if experimentgroup ==1
egen meansatisfication2= mean( satisfication ) if experimentgroup ==2
egen meansatisfication3= mean( satisfication ) if experimentgroup ==3
egen meansatisfication4= mean( satisfication ) if experimentgroup ==4

***************
* Table 1  *
***************
use replication_data.dta,clear
keep if shenzhen==0
regress satisfication c.factor1##c.factor2
est store Logit_1

use replication_data.dta,clear
keep if shenzhen==1
regress satisfication c.factor1##c.factor2
est store Logit_2
esttab Logit_1 Logit_2   using table1.rtf, replace scalars(F) r2 ar2 mtitle(M1 M2) b(%6.3f) se(%6.3f) star(* 0.1 ** 0.05 *** 0.01)

*********************************************
**************** Appendix ***************
// Table 1A  *
***************
**Count
use replication_data.dta,clear
keep if shenzhen==0
tab age
tab gender
tab livetime
tab fulltime
tab employmenttype
tab education

use replication_data.dta,clear
keep if shenzhen==1
tab age
tab gender
tab livetime
tab fulltime
tab employmenttype
tab education

**Pearson Chi-square test
use replication_data.dta,clear
tabulate age shenzhen,chi2
tabulate gender shenzhen,chi2
tabulate livetime shenzhen,chi2
tabulate fulltime shenzhen,chi2
tabulate employmenttype shenzhen,chi2
tabulate education shenzhen,chi2
